#include <iostream>

using namespace std;

// 1. Prompt the user for the current date and time on the road.
// 2. Calculate the time of arrival.
// 3. Print the time of arrival.

int main()
{
	int hour, min, sec, riding; // hour - used to store the hours
				    // min - used to store the current minutes
				    // sec - used to store the current seconds
				    // riding - estimated time on road

	// prompts
	cout << "Please enter current time and estimated time on road:" << endl;
	cin >> hour >> min >> sec >> riding;
	if((hour <= 23) && (hour >= 0))
	{
		if((min <= 59) && (min >= 0))
		{
			if((sec <= 59) && (sec >=0))
			{
				sec =  (sec + riding) % 60;
				hour += ((riding / 60) + min + sec) / 60;
				min = ((riding / 60) + min) % 60;

				cout << "You will arrive at: " << hour << ':' << min << ':' << sec << endl;

			}
			else // sec > 59
			{
				cout << "Please enter a correct seconds format" << endl;
			}
		}
		else // minutes > 59
		{
			cout << "Please enter a correct minutes format" << endl;
		}
	}
	else // hour > 23
	{
		cout << "Please enter a correct hour format" << endl;
	}

}
//output
//Please enter current time and estimated time on road: 12 30 00 180
//You will arrive at: 12:33:0
